package com.situ.team5.kzq.recruit.dao;

import com.situ.team5.pojo.ConfigPublicChar;
import com.situ.team5.pojo.EngageResume;
import org.apache.ibatis.annotations.*;
import org.springframework.transaction.annotation.Transactional;


import java.util.List;
import java.util.Map;

//简历管理DAO
@Mapper
public interface EngageResumeDAO {
    //查询公共字段设置表attribute_kind 为国籍的数据
    @Select("select * from config_public_char where attribute_kind=#{value}")
    List<ConfigPublicChar> config_public_charSelectGJ(String gj);
    //添加简历
@Insert("insert  into engage_resume  \n" +
        "(human_major_id,engage_type,human_name\n" +
        ",human_sex,human_email,human_telephone,human_homephone,human_mobilephone\n" +
        ",human_address,human_postcode\n" +
        ",human_nationality,human_birthplace,human_birthday\n" +
        ",human_race,human_religion,human_party,human_idcard\n" +
        ",human_age,human_college,human_educated_degree,human_educated_years\n" +
        ",human_educated_major,demand_salary_standard\n" +
        ",regist_time,human_specility,human_hobby\n" +
        ",human_history_records,remark,check_status,interview_status)\n" +
        "\n" +
        "values(#{human_major_id},#{engage_type},#{human_name}\n" +
        ",#{human_sex},#{human_email},#{human_telephone},#{human_homephone},#{human_mobilephone}\n" +
        ",#{human_address},#{human_postcode}\n" +
        ",#{human_nationality},#{human_birthplace},#{human_birthday}\n" +
        ",#{human_race},#{human_religion},#{human_party},#{human_idcard}\n" +
        ",#{human_age},#{human_college},#{human_educated_degree},#{human_educated_years}\n" +
        ",#{human_educated_major},#{demand_salary_standard}\n" +
        ",#{regist_time},#{human_specility},#{human_hobby}\n" +
        ",#{human_history_records},#{remark},#{check_status},#{interview_status})")
    void  engage_resumeInsert(EngageResume e);

//简历筛选全查

@Select("${sql}")
    List<Map>  engage_resumeSelectAll(Map map);




    @Select("select c.major_name,f.major_kind_name,m.* from  engage_resume m inner join" +
            " config_major c on m.human_major_id=c.major_id inner join " +
            " config_major_kind f on c.major_kind_id=f.major_kind_id"+
            " where res_id=#{value}")
    Map engage_resumeSelectOne(int id);

////简历筛选，推荐功能按钮//通过id对推荐人，推荐时间，推荐意见进行修改
    @Transactional
    @Update("update engage_Resume set pass_checker=#{pass_checker}," +
            "pass_check_time=#{pass_check_time},recomandation=#{recomandation}," +
            "pass_check_status=#{pass_check_status},check_status=#{check_status}," +
            "interview_status=#{interview_status},jl_status=#{jl_status} where res_id=#{res_id}")
    void kzqtj(EngageResume e);
    @Update("update engage_Resume set "+
            "interview_amount=#{interview_amount},interview_status=#{interview_status},jl_status=#{jl_status} where res_id=#{res_id}")
    void JlupdateInterview_amount(EngageResume r);
    @Update("update engage_Resume set "+
            "jl_status=#{jl_status} where res_id=#{res_id}")
    void update_jl_status(@Param("jl_status") Integer check_status,@Param("res_id") int id);

    @Delete("delete from engage_resume where res_id=#{value}")
    void engage_resume_delete(int id);
    //修改简历状态，修改 pass_passComment
    @Update("update engage_resume set jl_status=#{jl_status}," +
            " pass_checkComment=#{pass_checkComment} where res_id=#{res_id}")
    void update_pass_checkComment(EngageResume e);

    @Update("update engage_resume set jl_status=#{jl_status}," +
            " pass_passComment=#{pass_passComment} where res_id=#{res_id}")
    void update_pass_passComment(EngageResume e);
}


